package cn.javass.dp.prototype.demo1;

public class Realizetype implements Cloneable {

    public DemoPrototype pp = new DemoPrototype();

    Realizetype()
    {
        System.out.println("具体原型创建成功！");
    }
    public Object clone() throws CloneNotSupportedException
    {
        System.out.println("具体原型复制成功！");
        return (Realizetype)super.clone();
    }


    public static void main(String[] args) throws CloneNotSupportedException {
        Realizetype obj1=new Realizetype();
        Realizetype obj3=new Realizetype();
        Realizetype obj2=(Realizetype)obj1.clone();
        System.out.println("obj1==obj2?"+(obj1==obj2));
        System.out.println("obj1==obj2?"+(obj1==obj3));
        obj1.pp.name = 10;
        System.out.println("((:"+(obj1.pp.name));
        System.out.println("?"+(obj3.pp.name));
    }
}

class DemoPrototype {
    public int name = 5;
}
